home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Libraries / Finder.Lib < prev    next >
Encoding:
Text File  |  1993-12-17  |  6.6 KB  |  182 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        Finder.Lib
  5. #
  6. #    Contains:    xxx put contents here xxx
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #        <1+>     5/21/93    NAGA        Adding header and porting old files to follow new standards
  19. #
  20. # ****************************************************************************
  21. #
  22.  
  23. ########################################################################
  24. #                            External libraries 
  25. #=======================================================================
  26. Libraries "Output.Lib", "LaunchQuit.Lib", "StandardFile.Lib","UserInterface.Lib";
  27.  
  28. #########################################################################
  29. #                    HelpBalloons( n )
  30. #========================================================================
  31. # Author:        KTA
  32. # Description:    Turns Help Balloons ON/OFF
  33. # Parameters:    0 - To turn Help Balloons - OFF
  34. #                1 - To turn Help Balloons - ON
  35. #                2 - To toggle the Hide Balloons/Show Balloons 
  36. # Returns:        Nothing
  37. # Examples:        HelpBalloons( 0 );
  38. # Assumptions:    7.0x only!
  39. #========================================================================
  40. # History:
  41. #
  42. #########################################################################
  43. TASK HelpBalloons( n := 2 ) begin
  44.     if ( n = 2 )            #To select the HIDE/SHOW Balloons 
  45.             SelectMenuItem(/≈Balloons/,"");
  46.     
  47.     else begin
  48.         ShowBalloons  := match[menuitem t:"Show Balloons" m:[menu o:7]];
  49.         HideBalloons  := match[menuitem t:"Hide Balloons" m:[menu o:7]];
  50.             
  51.         if ( n = 1 ) begin     #To make insure Help Balloons is on
  52.             if (ShowBalloons)
  53.                 SelectMenuItem("Show Balloons","");
  54.             Else
  55.                 LogStr("Help Balloons currently running");
  56.         end;
  57.         else if ( n = 0 ) begin        #To make insure Help Balloons is off
  58.             if (HideBalloons)
  59.                 SelectMenuItem("Hide Balloons","");
  60.             Else
  61.                 LogStr("Help Balloons currently disabled");
  62.         end;
  63.     end;
  64. end;
  65.  
  66. #########################################################################
  67. #            FinderNavigate( PathList, OpenFlag )    
  68. #========================================================================
  69. # Author:        Kevin Avoy (ext. 45604)
  70. # Description:    Navigates in the Finder by typing.  FinderNavigate insures
  71. #                that Finder is the current app and closes all windows.
  72. #                Then he types each item in Pathlist to select the next folder
  73. #                and Command-'O' to open the selected folder.
  74. # Parameters:    PathList := List of directories to open delimited by commas.
  75. #                OpenFlag := Set to 1 to select Comand-'O' for each directory
  76. #                            in the Pathlist.  If this is not true than only
  77. #                            the first item of pathlist will be typed. Use 0
  78. #                            to navigate to disks on desktop without opening.
  79. # Returns:        nada - No way to check - cross your fingers
  80. # Examples:        FinderNavigate({"HD","Folder1","Folder2"};
  81. # Assumptions:    Keyboard repeat rate must be off to type navigate successfully.
  82. #========================================================================
  83. # History:
  84. #
  85. #########################################################################
  86. TASK FinderNavigate(PathList := {},OpenFlag := 1) begin
  87.     tempTypeSpeed := TypeSpeed(50);
  88.     Println "------ Were Navigating in the Finder -------";
  89.     LaunchTwitch('Finder');
  90.     KeyEq('w',2);                # Closes all Finder Windows Command-Option-w
  91.     Wait(4);
  92.     If not(OpenFlag)
  93.         TypeStr(Pathlist[1]);    # If not select open only type the first item
  94.     else                         
  95.     begin
  96.         for each item in Pathlist
  97.         begin
  98.             TypeStr(item);        # Types the names in the path
  99.             keyEq('o');            # Selects open
  100.         end;
  101.     end;
  102.     TypeSpeed(tempTypeSpeed);
  103. end; # FinderNavigate()
  104.  
  105. #########################################################################
  106. #                ShimmerMateCopy( Source, Dest )    
  107. #========================================================================
  108. # Author:        Kevin Avoy (ext. 45604)
  109. # Description:    Opens ShimmerMate and copies the specified file from 
  110. #                Source -> Destination.  (ShimmerMate is an internal 
  111. #                Apple Tool for performing Finder operations using VU)
  112. # Parameters:    Source[1] := Pathlist for source document 
  113. #                Source[2] := Flag for Standard File navigation
  114. #                Dest[1] := Pathlist for Destination including new unique document
  115. #                           name.
  116. #                Dest[2] := Flag for Standard File navigation
  117. #                
  118. #                Pathlist: List of directories followed by the filename 
  119. #                          delimited by commas.
  120. #                Flag:
  121. #                    1 - Navigate using Standard File.
  122. #                    0 - Type in path and filename delimited by ':'s.
  123. # Returns:            0        :=    Failure
  124. #                    1        :=    Success
  125. # Example:        ShimmerMateCopy({{"HD","Folder1","MacPaint"},1},{{"My_Floppy","MacPaint"},0});
  126. #                    - ShimmerMateCopy[1]; will use Standard  File
  127. #                    - ShimmerMateCopy[2]; will type the path.
  128. # Assumptions:    Shimmermate (or Alias) is in the Apple Menu.
  129. #                Paths are correct.
  130. #                There is room on the Destination disk (Shimmermate doesn't check)
  131. #========================================================================
  132. # History:
  133. #
  134. #########################################################################
  135. TASK ShimmerMateCopy(Source := {{},1}, Dest := {{},1}) 
  136. begin
  137.     temp := Global gAppVerify;
  138.     gAppVerify := 0;
  139.     Launchtwitch('ShimmerMate');            # Assumes an alias to Shimmermate is in the Apple Menu.
  140.     Wait(5);
  141.     if (match[window t:'ShimmerMate' o:1]!) 
  142.     begin
  143.         LogStr("------ Were ShimmerMatin' it!!! ------",4);
  144.         selectRadioButton('Copy');
  145.         SelectFileButtons := Collect[button t:"Select File"];    # There are 2 buttons with the same name
  146.         if (Source[2])                         #If we use Standard File
  147.         begin
  148.             Select SelectFileButtons[2];    # Top button is ord 2        
  149.             LogStr("Selected the top 'Select File' button");
  150.             wait(2);        
  151.             SFNavigate(Source[1]);
  152.             SpecialKey(tabkey,"Tab Key");
  153.         end;
  154.         else                                # Type the path
  155.         begin
  156.             TypeList(Source[1],':');
  157.             SpecialKey(tabkey,"Tab Key");
  158.         end;
  159.         
  160.         if (Dest[2])                         #If we use Standard File
  161.         begin
  162.             Select SelectFileButtons[1];    #Bottom button is ord 1
  163.             LogStr("Selected the bottom 'Select File' button");
  164.             wait(2);
  165.             SFNavigate(Dest[1]);
  166.         end;
  167.         else                                # Type the path
  168.             TypeList(Dest[1],':');        
  169.         if not(selectButton("Do it"))
  170.             Return(0);
  171.         while(match[button t:'Do It' e:true]!);    # Disabled 'Do it' button is indicates completion.
  172.         selectButton("Quit");            # Quit Shimmermate
  173.         gAppVerify := temp;
  174.         return(1);
  175.     end;
  176.     else
  177.     begin
  178.         LogStr("!@#$% Sorry, ShimmerMate is not running");
  179.         gAppVerify := temp;
  180.         return(0);
  181.     end;
  182. end; # ShimmerMateCopy()